<%@ include file="/includes.jsp" %>
<%@ include file="/header.jsp" %>

<c:if test="${not empty error}">
    <div class="errorHeader">${error}</div>
</c:if>

<c:choose>
    <c:when test="${user.new}">
        <h2>Create Account</h2>
    </c:when>
    <c:otherwise>
        <h2>Update Account</h2>
    </c:otherwise>
</c:choose>

<form:form modelAttribute="user">
    <table >
        <col align="right" />
        <col align="left" />
        <col align="left" />
        <tr>
            <td>First Name:</td>
            <td><form:input path="firstName" size="30" maxlength="80"/></td>
            <td><form:errors path="firstName" cssClass="errors"/></td>
        </tr>
        <tr>
            <td>Last Name:</td>
            <td><form:input path="lastName" size="30" maxlength="80"/></td>
            <td><form:errors path="lastName" cssClass="errors"/></td>
        </tr>
        <tr>
            <td>Email:</td>
            <td><form:input path="email" size="30" maxlength="80"/></td>
            <td><form:errors path="email" cssClass="errors"/></td>
        </tr>
        <tr>
            <td>Password: </td>
            <td><form:password path="password" showPassword="true"/></td>
            <td><form:errors path="password" cssClass="errors"/></td>
        <tr>
            <td colspan="3">
                <c:choose>
                    <c:when test="${user.new}">
                        <input class="submit" type="submit" value="Add User"/>
                    </c:when>
                    <c:otherwise>
                        <input class="submit" type="submit" value="Update User"/>
                    </c:otherwise>
                </c:choose>
                <input class="submit" type="reset" value="Reset">
            </td>
        </tr>
    </table>
</form:form>

<%@ include file="../footer.jsp" %>